package cn.yj.email;

import cn.yj.email.handle.Email;
import cn.yj.email.handle.EmailHandler;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;


/**
 * <br>
 *
 * @author 永健
 * @since 2019/3/23 22:55
 */
@Component
public class EmailInstance
{
    @Async
    public void sendEmail(Email email)
    {
        EmailHandler emailHandler = SpringBeanFactory.emaiInstance(email.getSubject().getValue());
        emailHandler.sendEmail(email);
    }

}
